Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize matching zones to a given address #15275

Merged
merged 24 commits into from
Sep 27, 2023
Merged

Conversation

jakubtobiasz
Copy link
Contributor

@jakubtobiasz jakubtobiasz commented Sep 6, 2023

Q A
Branch? 1.13
Bug fix? performance fix
New feature? no
BC breaks? no
Deprecations? no
Related tickets closes #9777
License MIT

Test data:
~1000 zones <-> zone members 1:1
~20 zones created with up to 7 level of nesting (zone in the zone in the zone...)

Before:
CleanShot 2023-09-15 at 17 07 08@2x

After:
CleanShot 2023-09-15 at 17 08 42@2x

@github-actions
Copy link

github-actions bot commented Sep 6, 2023

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

GSadee
GSadee previously approved these changes Sep 8, 2023
@jakubtobiasz jakubtobiasz changed the base branch from 1.12 to 1.13 September 12, 2023 07:02
@jakubtobiasz jakubtobiasz changed the title Add eager loading for Zone's members Optimize matching zones to a given address Sep 12, 2023
@jakubtobiasz jakubtobiasz changed the title Optimize matching zones to a given address 🚧 Optimize matching zones to a given address Sep 12, 2023
Copy link
Member

@diimpp diimpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it's a WIP, I'm just passing by 😅

@jakubtobiasz jakubtobiasz changed the title 🚧 Optimize matching zones to a given address Optimize matching zones to a given address Sep 15, 2023
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how to make it working without the sqlite database file :|. If anyone has an idea – I encourage to share or directly contribute. Otherwise let's merge it and wait for new test apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CleanShot 2023-09-15 at 19 12 49@2x 🤷🏼‍♂️

NoResponseMate
NoResponseMate previously approved these changes Sep 22, 2023
diimpp
diimpp previously requested changes Sep 24, 2023
Copy link
Member

@diimpp diimpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes is mostly for

--- $query
+++ $queryBuilder`

which I just noticed. (I didn't mark them all)

P.S. Sorry for the "waves" reviews, I hope next one be the last one.

@@ -142,7 +143,7 @@ private function addResourcesSection(ArrayNodeDefinition $node): void
->scalarNode('model')->defaultValue(Zone::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(ZoneInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('repository')->defaultValue(ZoneRepository::class)->cannotBeEmpty()->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sylius bundles never specify repository at Configuration.php

image

I'm questioning this for years, but never actually research how and why it works this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a custom repository then it's declared in the config
CleanShot 2023-09-25 at 10 44 58

Copy link
Member

@diimpp diimpp Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not true for 1.12, every instance that you've found was introduced in 1.13.

I still don't know why it was done this way and how it even work, but custom repositories are not specified for Configuration for any of the bundle

@GSadee GSadee dismissed diimpp’s stale review September 27, 2023 10:07

Changes have been applied

@GSadee GSadee merged commit 3dd0110 into Sylius:1.13 Sep 27, 2023
25 checks passed
@GSadee
Copy link
Member

GSadee commented Sep 27, 2023

Thanks, Jacob! 🎉

/**
* @implements ZoneRepositoryInterface<ZoneInterface>
*/
class ZoneRepository extends EntityRepository implements ZoneRepositoryInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that a new repository for an existing resource has shown up should be noted in the upgrade file. If someone has already created a custom one prior, the matcher will just fail.

];

public function __construct(private RepositoryInterface $zoneRepository)
public function __construct(private ZoneRepositoryInterface $zoneRepository)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also be noted in the upgrade file

@jakubtobiasz jakubtobiasz deleted the SYL-2705 branch October 12, 2023 12:13
NoResponseMate added a commit that referenced this pull request Jan 17, 2024
This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13 <!-- see the comment below -->                  |
| Bug fix?        | yes                                                       |
| New feature?    | no                                                      |
| BC breaks?      | not anymore                                                      |
| Related tickets | #15275 (comment)  |
| License         | MIT                                                          |


Commits
-------
  [Upgrade] Note ZoneRepository addition and ZoneMatcher constructor changes
  [Addressing] Support BC for ZoneMatcher
  [ECS] Apply ecs fixes
GSadee pushed a commit to Sylius/SyliusAdminBundle that referenced this pull request Jan 18, 2024
This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13 <!-- see the comment below -->                  |
| Bug fix?        | yes                                                       |
| New feature?    | no                                                      |
| BC breaks?      | not anymore                                                      |
| Related tickets | Sylius/Sylius#15275 (comment)  |
| License         | MIT                                                          |


Commits
-------
  [Upgrade] Note ZoneRepository addition and ZoneMatcher constructor changes
  [Addressing] Support BC for ZoneMatcher
  [ECS] Apply ecs fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance issue: too many database queries when many zones
7 participants